﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WebSite1
{
    public partial class mywhishlist : System.Web.UI.Page
    {
        public int Dataindex;
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                Dataindex = 0;
                foreach (DataRow currnetrow in ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).Table.Rows)
                {
                    Dataindex = Dataindex + 1;
                    if ((Request["w_id"] != null) && currnetrow["wishlist_id"].ToString() == Request["w_id"].ToString())
                    {
                        GridView4.PageIndex = (int)Dataindex / GridView4.PageSize - 1;

                    }
                }
                GridView4.SelectedIndex = 0;
            }
           
        }

        protected void GridView4_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //if (e.Row.RowType == DataControlRowType.DataRow)
            //{
            //    Dataindex = Dataindex +1;
            //    DataRowView rowView = (DataRowView)e.Row.DataItem;

            //    if ((Request["w_id"] != null ) && rowView["wishlist_id"].ToString() == Request["w_id"].ToString())
            //    {
            //        e.Row.RowState = DataControlRowState.Selected;
            //        GridView4.SelectedIndex = e.Row.RowIndex;
            //        // TextBox2.Text = GridView4.SelectedRow.ToString() + " "+ e.Row.DataItem.ToString(); 

            //        GridView3.DataBind();
            //        GridView4.PageIndex = (int) Dataindex / GridView3.PageSize;

            //    }
            //}
        }

        protected void GridView4_RowCreated(object sender, GridViewRowEventArgs e)
        {

        }

        protected void GridView4_Load(object sender, EventArgs e)
        {


        }

        protected void GridView4_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridView3.DataBind();
        }
    }
}